#include <iostream>
using namespace std;

int main() {

	string s1,s2;
	cin>>s1>>s2;
	int n=static_cast<int>(s1.size());
	int m=static_cast<int>(s2.size());
	int nRet=n;
	for(int i=0;i+n-1<m;++i){
		int nCnt=0;
		for(int j=0;j<n;++j){
			if(s1[j]!=s2[i+j]){
				++nCnt;
			}
		}
		nRet=min(nRet,nCnt);
	}
	cout<<nRet<<endl;
	
	return 0;
}
 
